import os

def copySymLink(srcFile, dstFile):
  if os.path.islink(srcFile):
    try:
      linkTo = os.readlink(srcFile)
      os.symlink(linkTo,dstFile)
    except OSError as e:
      return 1,"create symbol link failed:" + str(e)
    return 0,''
  else:
    return 1, "not symbol link"
  
def getSymLinkSize(symLink):
   if os.path.islink(symLink):
     try:
       s = os.lstat(symLink).st_size
     except:
       return 1,"get size faile:" + str(e)
     return 0,''
   else:
     return 0,''

copySymLink("/home/AAA/lf", "/home/AAA/lf2")
copySymLink("/home/AAA/ld", "/home/AAA/ld2")

print(getSymLinkSize("/home/AAA/lf"))
print(getSymLinkSize("/home/AAA/ld"))

